#-*- coding: utf8 -*-
from tutor.script import *
from tutor.plugin.maple import *

# variáveis úteis
half = M('1/2')
t = M.t
_i, _j, _k = M('_i, _j, _k')
rr = M('`..`')

# parâmetros iniciais
a = M(oneof(1,2,3))
b = a + oneof(1, 2)
a, b = oneof((a,b), (b,a))
r = oneof(1,2,3,4,5) * oneof(-1, 1)
s = oneof(1,2,3,4,5) * oneof(-1, 1)

# ATENCAO! --- prova --------------------------------------------
r, s = -2, -5
a, b = M(3), M(5)

F = r*y * _i + s*x * _j
Fx = M.coeff(F, _i)
Fy = M.coeff(F, _j)
print('a: %s, b: %s\nF: %s' % (a,b,F))

# respostas
work = a*b * (r - s) / 2
wDiagE = a*b * (3*r + s) / 2
wDiagO = -a*b * (r + s) / 2
wElemL = r*a*b + (b+a) * (r*a**3 + s*b*a**2) / (2*b**2)
wMod = r*a*b + M.sqrt((b**2+a**2) * (r**2*a**2 + s**2*b**2)) * a**2 / (2*b**2)

print('work: %s' % work)
print('wDiagE: %s' % wDiagE)
print('wDiagO: %s' % wDiagO)
print('wElemL: %s' % wElemL)
print('wMod: %s' % wMod)